<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "tba_supplierinfo".
 *
 * @property integer $id
 * @property string $supplierid
 * @property string $suppliername
 * @property string $supplierab
 * @property string $address
 * @property string $linkname
 * @property string $linktel
 * @property string $qq
 * @property string $email
 * @property integer $sortid
 * @property integer $state
 *
 * @property TmeInstockinfo[] $tmeInstockinfos
 */
class TbaSupplierinfo extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'tba_supplierinfo';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['supplierid', 'suppliername', 'address'], 'required'],
            [['sortid', 'state'], 'integer'],
            [['supplierid'], 'string', 'max' => 6],
            [['suppliername', 'linktel', 'qq', 'email'], 'string', 'max' => 50],
            [['supplierab'], 'string', 'max' => 25],
            [['address'], 'string', 'max' => 200],
            [['linkname'], 'string', 'max' => 20]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'supplierid' => 'Supplierid',
            'suppliername' => 'Suppliername',
            'supplierab' => 'Supplierab',
            'address' => 'Address',
            'linkname' => 'Linkname',
            'linktel' => 'Linktel',
            'qq' => 'Qq',
            'email' => 'Email',
            'sortid' => 'Sortid',
            'state' => 'State',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getTmeInstockinfos()
    {
        return $this->hasMany(TmeInstockinfo::className(), ['tba_id' => 'ID', 'supplierid' => 'SupplierID']);
    }
}
